import React, {Component} from 'react'
import {Button, Col, Form, Input, Row, Space, Table} from 'antd'
import {PlusOutlined} from '@ant-design/icons'
import PaginationComponent from '../common/paginationComponent'

/* eslint-disable */
class UnitManagement extends Component {
    state = {
        pageNumber: 1,
        pageSize: 10,
        totalRow: 0,
        dataSource: [],
        unitId: '',
        modelVisible: false,
        modalTitle: '',
        year: '',
        looks: {},
        files: [],
        imagesList: [],
        filesList: [],
        confirmClick: false
    }

    componentDidMount() {
    }

    componentWillUnmount() {
        this.setState = (state, callback) => {
        }
    }

    /*获取单位列表*/
    getUnitList = () => {
       
    }

    /*分页操作事件*/
    pageChangeHandle = (pageNumber, pageSize) => {
        this.setState({pageNumber, pageSize}, () => {
          
        });
    }

    /*重置查询条件*/
    resetFormHandle = () => {
        this.refs.filterRef.resetFields();
        this.getUnitList();
    }

    /*添加单位*/
    addUnitHandle = () => {
     
    }

    /*查看*/
    lookUnitHandle = item => {
      

    }

    /*修改单位*/
    editUnitHandle = item => {
        
    }

    /*删除单位*/
    deleteUnitHandle = item => {
        
    }

    /*打开关闭添加单位窗口*/
    openCloseModal = (val, callback) => {
      
    }

    /*确认按钮*/
    confirmHandle = () => {
       
    }
    // 日期选择的回调函数
    DatePickerYear = (data, dateString) => {
      
    }

    /*添加/更新单位*/
    addOrUpdateUnitService = (url, values) => {
    }

    /*验证单位名称重复*/
    validateUnitName = (params, callback) => {
      
    }

    render() {
        const {
            pageNumber, pageSize, totalRow, dataSource, } = this.state;
        const pageProps = {
            pageNumber, pageSize, totalRow, pageChangeHandle: this.pageChangeHandle
        }
        const columns = [
            {title: '序号', dataIndex: 'key', key: 'key', align: 'center', width: 80},
            {title: '单位名称', dataIndex: 'name', key: 'name', align: 'center', width: 300, ellipsis: true},
            {title: '单位地址', dataIndex: 'address', key: 'address', align: 'center', ellipsis: true},
            {title: '联系电话', dataIndex: 'mobile', key: 'mobile', align: 'center', width: 180},
            {title: '年度', dataIndex: 'year', key: 'year', align: 'center', width: 80},
            {title: '法人姓名', dataIndex: 'legalPerson', key: 'legalPerson', align: 'center', width: 100},
            {title: '联络人', dataIndex: 'person', key: 'person', align: 'center', width: 100},
            {title: '联络人身份证号', dataIndex: 'idCard', key: 'idCard', align: 'center', width: 200},
            {
                title: '操作', dataIndex: 'operate', key: 'operate', align: 'center', width: 200,
                render: (text, record) => {
                    return <div className="operate_link_group">
                        <span className="red_link" onClick={this.lookUnitHandle.bind(this, record)}>查看</span>
                        <span className="audit_link" onClick={this.editUnitHandle.bind(this, record)}>编辑</span>
                        <span className="edit_link" onClick={this.deleteUnitHandle.bind(this, record)}>删除</span>
                    </div>
                }
            }
        ]
        const tableProps = {
            dataSource,
            columns,
            pagination: false
        }

        return (
            <>
                <div className="system_management_content_style animate__animated animate__fadeIn">
                    <Row className="filter_section">
                        <Col span={2} className="animate__animated animate__fadeInLeft">
                            <span className="filter_label">条件查询</span>
                        </Col>
                        <Col span={22} className="filter_search">
                            <Row className="custom_filter_form_style">
                                <Col span={18} className="animate__animated animate__fadeInDown">
                                    <Form ref="filterRef" layout="inline" autoComplete="off" initialValues={{name: ''}}>
                                        <Form.Item label="单位名称" name="name">
                                            <Input placeholder="单位名称" autocomplate="off"/>
                                        </Form.Item>
                                    </Form>
                                </Col>
                                <Col span={6} className="clearFix animate__animated animate__fadeInRight">
                                    <Space size={30} className="float-right">
                                        <Button type="primary" className="custom_button_style search_result"
                                                onClick={this.getUnitList}>搜索</Button>
                                        <Button type="primary" className="custom_button_style"
                                                onClick={this.resetFormHandle}>重置</Button>
                                    </Space>
                                </Col>
                            </Row>
                        </Col>
                    </Row>
                    <Row className="filter_section">
                        <Col span={16} className="animate__animated animate__fadeInLeft">
                            <span className="filter_label">单位列表</span>
                        </Col>
                        <Col span={8} className="clearFix animate__animated animate__fadeInRight">
                            <Space size={30} className="float-right">
                                <Button type="primary" className="custom_button_style remove_all auto_width"
                                        icon={<PlusOutlined/>} onClick={this.addUnitHandle}>添加单位</Button>
                            </Space>
                        </Col>
                    </Row>
                    <div className="table_box animateFadeInUp">
                        <Table className="custom_table_style" {...tableProps}/>
                        <PaginationComponent {...pageProps}/>
                    </div>
               
                </div>
            </>
        )
    }
}

export default UnitManagement